/**
 * redux
 * created by xq
 */
import { compose, createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import rootReducer from './reducer'

/**
 * 返回加强的createstore方法
 */
const fCreateStore = compose(applyMiddleware(thunk))(createStore)
/**
 * 配置创建的store
 * @param {any} initState 初始state
 * @returns {Object} 返回store对象
 */
export default function configCreateStore(initState) {
  const store = fCreateStore(rootReducer, initState)
  // if(module.hot) {
  //   module.hot.accept('./reducers', () => {
  //       store.replaceReducer(require('./reducers'))
  //   })
  // }
  return store
}